package com.qf.smartdevice.task;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/*
 * 检查设备 在线状态的定时认为i
 * */
@Component//交给spring 创建当前对象

public class CheckDevicesStatusTask {
    @Autowired
    private CheckDevicesStatusTask evnent;
    private ApplicationContext context;

    @Scheduled(fixedRate = 10000)
    public void checkStatus() {
        System.err.println("检查设备状态的定时任务执行了");
        context.publishEvent(evnent);
    }
}
